package ke08;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class DiagonalButtons {

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setText("Meine SWT GUI");

		GridLayout gridLayout = new GridLayout();
		shell.setLayout(gridLayout);

		shell.pack();

		Monitor primary = display.getPrimaryMonitor();
		Rectangle bounds = primary.getBounds();
		Rectangle shellBounds = shell.getBounds();
		int x = bounds.x + (bounds.width - shellBounds.width) / 2;
		int y = bounds.y + (bounds.height - shellBounds.height) / 2;
		shell.setLocation(x, y);
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		shell.dispose();
	}

}
